#ifndef _M_UART1_H
#define _M_UART1_H

#define U1_DATA_BUF (64)

/*******************************************************************************
 * USART1 FRAME
 ******************************************************************************/
typedef struct {
    uint8_t  pktHd;
    uint16_t pktLen;
    uint8_t  cmd;
    uint8_t  dataLen;
    uint8_t  dataBuf[U1_DATA_BUF];
    uint16_t crcRx;
    uint16_t crcGen;
    bool isRxFinish;
} RxPkt;
extern RxPkt u1RxPkt;

typedef struct {
    uint8_t  pktHd;
    uint16_t pktLen;
    uint8_t  cmd;
    uint8_t  dataLen;
    uint8_t  dataBuf[U1_DATA_BUF];
    uint16_t crcGen;
} TxPkt;
extern TxPkt u1TxPkt;

void U1Debug(uint8_t data);
void Uart1Comm_Init(void);
void ExtendAxisComm_RxTx(void);
void ExtendAxisEnterBoot(void);
void ExtendAxis_BuildRecPack(void);
void BuildTxPktToExtendAxis(void);
void ExtendAxis_CommandHandler_Execute(void);
void ExtendAxis_FillTxBytesWithRplyPack(void);

#endif

